package testing.comparer;

import static org.junit.Assert.assertEquals;

import org.junit.Before;
import org.junit.Test;

import words.AWL;
import words.Noun;

import comparer.AWLComparer;
import comparer.NounComparer;


public class NounComparerTest {
	NounComparer comparer;
	Noun origin_noun;
	Noun compared_noun;
	@Before
	public void setUp() throws Exception {
		this.comparer = new NounComparer();
		this.origin_noun = new Noun();
		this.compared_noun = new Noun();
	}
	@Test
	public void test1()
	{
		String origin[] = {"Tom","Cruise"};
		String compare[] = {"Tom","Cruise"};
		origin_noun.input(origin);
		compared_noun.input(compare);
		comparer.set_origin(origin_noun);
		comparer.set_compared(compared_noun);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test2()
	{
		String origin[] = {"Tom","Cruise"};
		String compare[] = {"Tom","Cruise","Chan"};
		origin_noun.input(origin);
		compared_noun.input(compare);
		comparer.set_origin(origin_noun);
		comparer.set_compared(compared_noun);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,0);
	}
	@Test
	public void test3()
	{
		String origin[] = {"Tom","Cruise"};
		String origin2[] = {"Charles","Ng","Hang"};
		String compare[] = {"Tom","Cruise"};
		String compare2[] = {"Charles","Ng","Hang"};
		origin_noun.input(origin);
		origin_noun.input(origin2);
		compared_noun.input(compare);
		compared_noun.input(compare2);
		comparer.set_origin(origin_noun);
		comparer.set_compared(compared_noun);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,2);
	}
	@Test
	public void test4()
	{
		String origin[] = {"Tom","Cruise"};
		String origin2[] = {"Charles","Ng","Hang"};
		String compare[] = {"Tom","Cruise","Chan"};
		String compare2[] = {"Charles","Ng","Hang"};
		origin_noun.input(origin);
		origin_noun.input(origin2);
		compared_noun.input(compare);
		compared_noun.input(compare2);
		comparer.set_origin(origin_noun);
		comparer.set_compared(compared_noun);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,1);
	}
	@Test
	public void test5()
	{
		String origin[] = {"Tom","Cruise"};
		String origin2[] = {"Ng","Charles","Hang"};
		String compare[] = {"Tom","Cruise","Chan"};
		String compare2[] = {"Charles","Ng","Hang"};
		origin_noun.input(origin);
		origin_noun.input(origin2);
		compared_noun.input(compare);
		compared_noun.input(compare2);
		comparer.set_origin(origin_noun);
		comparer.set_compared(compared_noun);
		comparer.compare();
		int result = comparer.getResult();
		assertEquals(result,0);
	}
}
